<template>
  <el-menu
        active-text-color="#ffd04b" background-color="#545c64" class="el-menu-vertical-demo"
        default-active="2" text-color="#fff" style="height: 100%;">
        <el-sub-menu index="1">
          <template #title>
            <span>用户管理</span>
          </template>
          <el-menu-item index="1-1" @click="NavTo('/UserInfoAdd')">用户添加</el-menu-item>
          <el-menu-item index="1-2" @click="NavTo('/UserInfoList')">用户列表</el-menu-item>
        </el-sub-menu>
        <el-sub-menu index="2">
          <template #title>
            <span>角色管理</span>
          </template>
          <el-menu-item index="2-1" @click="NavTo('/RoleAdd')">角色添加</el-menu-item>
          <el-menu-item index="2-2" @click="NavTo('/RoleList')">角色列表</el-menu-item>
        </el-sub-menu>
        <el-sub-menu index="4">
          <template #title>
            <span>菜单权限管理</span>
          </template>
          <el-menu-item index="4-1" @click="NavTo('/MenuAdd')">菜单添加</el-menu-item>
          <el-menu-item index="4-2" @click="NavTo('/MenuList')">菜单列表</el-menu-item>
        </el-sub-menu>

        <el-sub-menu index="3">
          <template #title>
            <span>角色菜单权限</span>
          </template>
          <el-menu-item index="3-1" @click="NavTo('/PrivilegLIst')">权限添加</el-menu-item>
        </el-sub-menu>

        <el-menu-item index="8-1" @click="Exit()">退出登录<span style="color: cadetblue;">(已登录)</span></el-menu-item>
      </el-menu>
</template>

<script lang="ts" setup>
import { useRouter } from 'vue-router'

const router=useRouter();
const NavTo =(name:string)=>{
  router.push(name)
}
const Exit=()=>{
  localStorage.removeItem('isLogin')
  router.push({name:'Login'});
};
</script>